<html>
<title>iframe</title>
<SCRIPT type="text/javascript" language="JavaScript">
function PrintIframe() {
    // Standard way
    //window.frames["inner_frame"].focus();
    //window.frames["inner_frame"].print();
    // IE6 way
	//document.inner_frame.focus();
	//document.inner_frame.print();
    // IE7 way. That's the way Safari does it.
	window.frames["inner_frame"].document.execCommand('print',false,null)
}
function DelayedPrint() {
  setTimeout(PrintIframe, 0);
}
</SCRIPT>
<body onload="javascript:DelayedPrint()">

<p>
<a href="javascript:PrintIframe()"><img src="click_me.png" /></a>
<p>
<div>
<iframe src="test2.html" id="inner_frame" style="height:150px; margin:0px; padding:0px"><html><body>A</body></html></iframe>
</div>
<br>
<img src="sadtab.png" />
</body>
</html>
